import { onMounted, onUnmounted } from "vue";

function useEventListener(target, eventName, callback) {
  onMounted(() => {
    target.addEventListener(eventName, callback, false);
  });

  onUnmounted(() => {
    target.removeEventListener(eventName, callback, false);
  });
}

export default useEventListener;
